﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CSharpHelpers.TransferProtocols
{
    public struct NetworkMessage
    {
        public int CommandCode;
        public int TranssferCode;
        public int ParameterCount;
        public int SourceType;
        public string SourceCode;
        public int DestinationType;
        public string DestinationCode;
        public int MessageID;
    }

    public struct LoginPoll7201
    { 
        public string message;

        public LoginPoll7201(string gameTableID, string videoDealerID)
        {
            this.message = "{" + LTProtoBuffer.IntToString(7201, 4) + "}{" + LTProtoBuffer.IntToString(0, 1) + "}{" + LTProtoBuffer.IntToString(7, 2) + "}"
               + ProtocolCSharp.BuildHeadLength()
               + "{" + LTProtoBuffer.IntToString(4, 2) + "}"
               + "{" + LTProtoBuffer.IntToString(4, 2) + "}"
               + ProtocolCSharp.BuildHeadValue(7201, 0)
               + "{" + LTProtoBuffer.IntToString(int.Parse(gameTableID), 4) + "}"
               + "{" + LTProtoBuffer.IntToString(int.Parse(videoDealerID), 4) + "}"; 
        }
    }

    public struct LoginResponsePoll7201 
    {
        public NetworkMessage NetworkMsg;
        public bool IsSucceed;

        public LoginResponsePoll7201(List<string> megs)
        {
            this.NetworkMsg = LTProtoBuffer.ConvertReceiveNetworkMessage(megs);
            this.IsSucceed = LTProtoBuffer.ConvertStringToBool(megs, 0);
        }
    }

    public struct SendGameTableIDPoll1008
    {
        public string message;

        public SendGameTableIDPoll1008(string gameTableID)
        {
            this.message = "{" + LTProtoBuffer.IntToString(1008, 4) + "}{" + LTProtoBuffer.IntToString(0, 1) + "}{" + LTProtoBuffer.IntToString(9, 2) + "}"
             + ProtocolCSharp.BuildHeadLength()
             + "{" + LTProtoBuffer.IntToString(4, 2) + "}"
             + "{" + LTProtoBuffer.IntToString(4, 2) + "}"
             + "{" + LTProtoBuffer.IntToString(4, 2) + "}"
             + "{" + LTProtoBuffer.IntToString(4, 2) + "}"
             + ProtocolCSharp.BuildHeadValue(1008, 0)
             + "{" + LTProtoBuffer.IntToString(1, 4) + "}"
             + "{" + LTProtoBuffer.IntToString(1, 4) + "}"
             + "{" + LTProtoBuffer.IntToString(1, 4) + "}"
             + "{" + LTProtoBuffer.IntToString(int.Parse(gameTableID), 4) + "}";
        }
    }
 

    public struct NextStatusPoll7205
    {
        public NetworkMessage NetworkMsg;
        public int GameTableID;
        public int NextStatus;

        public NextStatusPoll7205(List<string> megs)
        {
            this.NetworkMsg = LTProtoBuffer.ConvertReceiveNetworkMessage(megs);
            this.GameTableID = LTProtoBuffer.ConvertStringToInt32(megs, 0);
            this.NextStatus = LTProtoBuffer.ConvertStringToInt32(megs, 1);
        }
    }

    public struct BaccaraHistory1102
    {
        public NetworkMessage NetworkMsg;
        public int GameTableID;
        public string History;

        public BaccaraHistory1102(List<string> megs)
        {
            this.NetworkMsg = LTProtoBuffer.ConvertReceiveNetworkMessage(megs);
            this.GameTableID = LTProtoBuffer.ConvertStringToInt32(megs, 0);
            this.History = LTProtoBuffer.ConvertString(megs, 10);
        }
    }

    public struct BaccaratLimit1203
    {
        public NetworkMessage NetworkMsg;
        public int GameTableID;
        public string MinLimit;
        public string MaxLimit;

        public BaccaratLimit1203(List<string> megs)
        {
            this.NetworkMsg = LTProtoBuffer.ConvertReceiveNetworkMessage(megs);
            this.GameTableID = LTProtoBuffer.ConvertStringToInt32(megs, 0);
            this.MinLimit = LTProtoBuffer.ConvertString(megs, 1);
            this.MaxLimit = LTProtoBuffer.ConvertString(megs, 2);
        }
    }

    public struct RouletteHistory1202
    {
        public NetworkMessage NetworkMsg;
        public int GameTableID;
        public string History;

        public RouletteHistory1202(List<string> megs)
        {
            this.NetworkMsg = LTProtoBuffer.ConvertReceiveNetworkMessage(megs);
            this.GameTableID = LTProtoBuffer.ConvertStringToInt32(megs, 0);
            this.History = LTProtoBuffer.ConvertString(megs, 10);
        }
    }

    public struct RouletteLimit1203
    {
        public NetworkMessage NetworkMsg;
        public int GameTableID;
        public string MinLimit;
        public string MaxLimit;

        public RouletteLimit1203(List<string> megs)
        {
            this.NetworkMsg = LTProtoBuffer.ConvertReceiveNetworkMessage(megs);
            this.GameTableID = LTProtoBuffer.ConvertStringToInt32(megs, 0);
            this.MinLimit = LTProtoBuffer.ConvertString(megs, 1);
            this.MaxLimit = LTProtoBuffer.ConvertString(megs, 2);
        }
    }

    public struct NewGame7001
    {
        public NetworkMessage NetworkMsg;
        public int GameTableID;

        public NewGame7001(List<string> megs)
        {
            this.NetworkMsg = LTProtoBuffer.ConvertReceiveNetworkMessage(megs);
            this.GameTableID = LTProtoBuffer.ConvertStringToInt32(megs, 0);
        }
    }

    public struct NoMoreBet7002
    {
        public NetworkMessage NetworkMsg;
        public int GameTableID;

        public NoMoreBet7002(List<string> megs)
        {
            this.NetworkMsg = LTProtoBuffer.ConvertReceiveNetworkMessage(megs);
            this.GameTableID = LTProtoBuffer.ConvertStringToInt32(megs, 0);
        }
    }

    public struct StartDeal7003
    {
        public NetworkMessage NetworkMsg;
        public int GameTableID;

        public StartDeal7003(List<string> megs)
        {
            this.NetworkMsg = LTProtoBuffer.ConvertReceiveNetworkMessage(megs);
            this.GameTableID = LTProtoBuffer.ConvertStringToInt32(megs, 0);
        }
    }

    public struct RoundBalance7005
    {
        public NetworkMessage NetworkMsg;
        public int GameTableID;
        public string ResultContent;
        public int ResultCount;
        public int RoundID;

        public RoundBalance7005(List<string> megs)
        {
            this.NetworkMsg = LTProtoBuffer.ConvertReceiveNetworkMessage(megs);
            this.GameTableID = LTProtoBuffer.ConvertStringToInt32(megs, 0);
            this.ResultContent = LTProtoBuffer.ConvertString(megs, 1);
            this.ResultCount = LTProtoBuffer.ConvertStringToInt32(megs, 2);
            this.RoundID = LTProtoBuffer.ConvertStringToInt32(megs, 3);
        }

    }
}
